package com.myidis.servlet;

import com.myidis.entity.AnalysisIndex;
import com.myidis.entity.AnalysisTheme;
import com.myidis.mapper.CIDIIndexManagementMapper;
import com.myidis.mapper.SubjectAnalyticMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CIDIIndexManagementServlet {
    @Autowired
    private CIDIIndexManagementMapper CIDIIndexManagementMapper;
    @Autowired
    private SubjectAnalyticMapper subjectAnalyticMapper;

    public ArrayList<AnalysisIndex> all(){
        return CIDIIndexManagementMapper.all();
    }

    public ArrayList<AnalysisTheme> list() {
        return subjectAnalyticMapper.allName();
    }

    public int add(AnalysisIndex add){
        return CIDIIndexManagementMapper.insert(add);
    }

    public int update(AnalysisIndex upd){
        return CIDIIndexManagementMapper.update(upd);
    }

    public int delete(AnalysisIndex del){
        return CIDIIndexManagementMapper.delete(del.getIndex(),del.getCombination());
    }
}
